package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbQyaqxsbg;
import com.ruoyi.tjbb.service.ISysTjbbQyaqxsbgService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 企业安全行驶报告Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/qysjtj/qyaqxsbg")
public class SysTjbbQyaqxsbgController extends BaseController
{
    @Autowired
    private ISysTjbbQyaqxsbgService sysTjbbQyaqxsbgService;

    /**
     * 查询企业安全行驶报告列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:qyaqxsbg:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbQyaqxsbg sysTjbbQyaqxsbg)
    {
        startPage();
        List<SysTjbbQyaqxsbg> list = sysTjbbQyaqxsbgService.selectSysTjbbQyaqxsbgList(sysTjbbQyaqxsbg);
        return getDataTable(list);
    }

    /**
     * 导出企业安全行驶报告列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:qyaqxsbg:export')")
    @Log(title = "企业安全行驶报告", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbQyaqxsbg sysTjbbQyaqxsbg)
    {
        List<SysTjbbQyaqxsbg> list = sysTjbbQyaqxsbgService.selectSysTjbbQyaqxsbgList(sysTjbbQyaqxsbg);
        ExcelUtil<SysTjbbQyaqxsbg> util = new ExcelUtil<SysTjbbQyaqxsbg>(SysTjbbQyaqxsbg.class);
        util.exportExcel(response, list, "企业安全行驶报告数据");
    }

    /**
     * 获取企业安全行驶报告详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:qyaqxsbg:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbQyaqxsbgService.selectSysTjbbQyaqxsbgById(id));
    }

    /**
     * 新增企业安全行驶报告
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:qyaqxsbg:add')")
    @Log(title = "企业安全行驶报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbQyaqxsbg sysTjbbQyaqxsbg)
    {
        return toAjax(sysTjbbQyaqxsbgService.insertSysTjbbQyaqxsbg(sysTjbbQyaqxsbg));
    }

    /**
     * 修改企业安全行驶报告
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:qyaqxsbg:edit')")
    @Log(title = "企业安全行驶报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbQyaqxsbg sysTjbbQyaqxsbg)
    {
        return toAjax(sysTjbbQyaqxsbgService.updateSysTjbbQyaqxsbg(sysTjbbQyaqxsbg));
    }

    /**
     * 删除企业安全行驶报告
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:qyaqxsbg:remove')")
    @Log(title = "企业安全行驶报告", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbQyaqxsbgService.deleteSysTjbbQyaqxsbgByIds(ids));
    }
}
